package metricmaster.gui;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import metricmaster.model.Activity;
import metricmaster.model.Project;

public class AppData {

    private static AppData instance = null;
    SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
    private Project project;

    protected AppData() {
        System.out.println("App Data");
        project = new Project();
        insertTestData();
    }

    public static AppData getInstance() {
        if (instance == null) {
            instance = new AppData();
        }
        return instance;
    }

    private void insertTestData() {
        project.setName("CPEC");
        try {
            project.setStart(format.parse("10-31-2013"));
            project.setFinish(format.parse("10-31-2014"));

            project.setWeeks(52);

        } catch (ParseException ex) {
            Logger.getLogger(AppData.class.getName()).log(Level.SEVERE, null, ex);
        }
        project.getProjectActivities().add(new Activity("BB17070", "Management", "1-Oct-13", "27-Sep-14"));
        project.getProjectActivities().add(new Activity("BB17270", "Code Unit Test", "1-Oct-13", "27-Sep-14"));



    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }
}
